package com.cxb;

import android.content.Intent;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.View;
import android.view.View.OnClickListener;

import com.amitek.aidl.mqtt.MqttServiceProxy;
import com.amitek.aidl.mqtt.bean.StatInfo;
import com.cxb.service.CXBMainService;
import com.cxb.service.FloatService;
import com.cxb.utils.SharedPreferencesUtils;

public class SetupWizardWeixin extends BaseActivity implements OnClickListener {
	private SharedPreferencesUtils sp;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.activity_setupwizardweixin);

		Intent bcintent = new Intent(FloatService.STOPHOMEKEY);
		this.sendBroadcast(bcintent);
		View weixin_bind = findViewById(R.id.weixin_bind);
		View vn_weixinnavi_close = findViewById(R.id.vn_weixinnavi_close);

		weixin_bind.setOnClickListener(this);
		vn_weixinnavi_close.setOnClickListener(this);
		sp = new SharedPreferencesUtils(this);
		sp.setIsSetupWizardWeiXin(true);
	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.weixin_bind) {
			Intent bcintent = new Intent(FloatService.SHOWHOMEKEY);
			this.sendBroadcast(bcintent);
			Intent i = new Intent();
			i.setClass(this, WeiXinBindActivity.class);
			startActivity(i);
			MqttServiceProxy mqttProxy = CXBMainService.getMqttProxy();
			if (mqttProxy != null) {
				try {
					mqttProxy.eventStatistics(StatInfo.WEIXIN);
				} catch (RemoteException e) {
					e.printStackTrace();
				}// 行程结束
			}

			finish();
		} else if (v.getId() == R.id.vn_weixinnavi_close) {
			Intent bcintent = new Intent(FloatService.SHOWHOMEKEY);
			this.sendBroadcast(bcintent);
			finish();
		}
	}
}
